//
//  FTVisitorViewController.swift
//  Weibo
//
//  Created by 方焘 on 16/6/11.
//  Copyright © 2016年 taofang. All rights reserved.
//

import UIKit

class FTVisitorViewController: UITableViewController {
     //MARK: 属性
    var isLogin = false
    
    var visitorView: FTVisitorView?
    
    override func loadView() {
        isLogin ? super.loadView() : setupVisitorView()
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    //MARK: 监听事件
    func didClickRigister() {
        print("点击了注册")
    }
    
    func didClickLogin() {
        print("点击了登录")
    }
    
//MARK: 界面设置
    func setupVisitorView() {
        visitorView = FTVisitorView()
        visitorView!.rigiestButtonClosure = {[weak self] in
            self!.didClickRigister()
        }
        visitorView!.loginButtonClosure = {[weak self] in
            self!.didClickLogin()
        }
        view = visitorView
        
        //设置导航栏
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: #selector(FTVisitorViewController.didClickRigister))
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: #selector(FTVisitorViewController.didClickLogin))
        
    }
    
    

}
